home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.metal;
-
- import com.sun.java.swing.ButtonModel;
- import com.sun.java.swing.Icon;
- import com.sun.java.swing.JButton;
- import com.sun.java.swing.plaf.UIResource;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Graphics;
- import java.io.Serializable;
-
- class MetalIconFactory$InternalFrameAltMaximizeIcon implements Icon, UIResource, Serializable {
- JButton parentButton;
- ButtonModel buttonModel;
- Color backgroundColor;
- Color titleColor;
- Color titleHighlight;
- Color edgeColor;
- Color smallEdgeColor;
- Color downRightHighlight;
- Color upLeftHighlight;
- int iconSize = 12;
-
- public MetalIconFactory$InternalFrameAltMaximizeIcon(int size) {
- this.iconSize = size;
- }
-
- public void paintIcon(Component c, Graphics g, int x, int y) {
- this.parentButton = (JButton)c;
- this.buttonModel = this.parentButton.getModel();
- this.downRightHighlight = MetalLookAndFeel.getPrimaryControlHighlight();
- this.upLeftHighlight = MetalLookAndFeel.getPrimaryControlShadow();
- this.backgroundColor = MetalLookAndFeel.getPrimaryControl();
- this.titleColor = MetalLookAndFeel.getPrimaryControlShadow();
- this.titleHighlight = MetalLookAndFeel.getPrimaryControlDarkShadow();
- this.edgeColor = MetalLookAndFeel.getPrimaryControlShadow();
- this.smallEdgeColor = MetalLookAndFeel.getPrimaryControlInfo();
- if (this.parentButton.getClientProperty("paintActive") != Boolean.TRUE) {
- this.downRightHighlight = MetalLookAndFeel.getControlHighlight();
- this.upLeftHighlight = MetalLookAndFeel.getControlShadow();
- this.backgroundColor = MetalLookAndFeel.getControl();
- this.titleColor = MetalLookAndFeel.getControlShadow();
- this.titleHighlight = MetalLookAndFeel.getControlDarkShadow();
- this.edgeColor = MetalLookAndFeel.getControlShadow();
- } else if (this.buttonModel.isPressed() && this.buttonModel.isArmed()) {
- this.backgroundColor = MetalLookAndFeel.getPrimaryControlShadow();
- this.titleColor = MetalLookAndFeel.getPrimaryControlDarkShadow();
- this.titleHighlight = MetalLookAndFeel.getPrimaryControlInfo();
- this.edgeColor = MetalLookAndFeel.getPrimaryControlDarkShadow();
- }
-
- int oneThird = this.iconSize / 3;
- int halfSize = this.iconSize / 2;
- g.translate(x, y);
- g.setColor(this.backgroundColor);
- g.fillRect(0, 0, this.iconSize, this.iconSize);
- g.setColor(this.downRightHighlight);
- g.drawLine(1, this.iconSize - 1, this.iconSize - 1, this.iconSize - 1);
- g.drawLine(this.iconSize - 1, 1, this.iconSize - 1, this.iconSize - 1);
- g.setColor(this.upLeftHighlight);
- g.drawLine(0, 0, 0, this.iconSize - 2);
- g.drawLine(0, 0, this.iconSize - 2, 0);
- g.setColor(this.edgeColor);
- g.drawRect(1, 1, this.iconSize - 3, this.iconSize - 3);
- g.setColor(this.smallEdgeColor);
- g.drawRect(1, oneThird, halfSize, halfSize);
- g.setColor(this.titleColor);
- g.fillRect(2, oneThird + 1, halfSize - 1, halfSize - oneThird);
- g.setColor(this.titleHighlight);
- g.drawLine(2, halfSize + 1, oneThird, halfSize + 1);
- g.drawLine(oneThird + 1, halfSize, halfSize, halfSize);
- g.translate(-x, -y);
- }
-
- public int getIconWidth() {
- return this.iconSize;
- }
-
- public int getIconHeight() {
- return this.iconSize;
- }
- }
-